<html>
<!-- =====================================================================

  File:      Generated file for Adventure Works Cycles Storefront Sample
  Summary:   Self-documentation for application
  Date:	     June 16, 2003

=====================================================================

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) 2003 Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= -->
<head>
  <link rel=stylesheet href=style.css>
</head>
<body>
<div class=SourcePanel style="font-size:12">
<pre style="background-color:white">
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Collections</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">ComponentModel</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Data</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Data</span>.<span style="color: #2040a0">SqlClient</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Drawing</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">WebControls</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">HtmlControls</span><span style="color: #4444FF">;</span>
<span style="color: #0000FF"><strong>using</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Globalization</span><span style="color: #4444FF">;</span>

<span style="color: #008000">/* =====================================================================

  File:      ShoppingCart.aspx.cs for Adventure Works Cycles Storefront Sample
  Summary:   Displays the contents of the shopping cart and provides the opportunity to update the cart or checkout
  Date:	     June 16, 2003

---------------------------------------------------------------------

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= */</span>

<span style="color: #0000FF"><strong>namespace</strong></span> <span style="color: #2040a0">Microsoft</span>.<span style="color: #2040a0">Samples</span>.<span style="color: #2040a0">SqlServer</span> <span style="color: #4444FF"><strong>{</strong></span>

    <span style="color: #0000FF"><strong>public</strong></span> <span style="color: #2040a0">partial</span> <span style="color: #0000FF"><strong>class</strong></span> <span style="color: #2040a0">ShoppingCart</span> <span style="color: #4444FF">:</span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">Page</span>
    <span style="color: #4444FF"><strong>{</strong></span>


<span style="color: #008000">//         public ShoppingCart() {</span>
<span style="color: #008000">//             Page.Init += new System.EventHandler(Page_Init);</span>
<span style="color: #008000">//         }</span>

        <span style="color: #008000">//*******************************************************</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// The Page_Load event on this page is used to load the</span>
        <span style="color: #008000">// ShoppingCart DataGrid *the first time* the page is</span>
        <span style="color: #008000">// accessed.</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// Note that subsequent postbacks to the page *do not*</span>
        <span style="color: #008000">// reload the Datagrid.  Instead, we rely on the control's</span>
        <span style="color: #008000">// built-in viewstate management to rebuild the control</span>
        <span style="color: #008000">// on the server.</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">//*******************************************************</span>

        <span style="color: #0000FF"><strong>private</strong></span> <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">Page_Load</span><span style="color: #4444FF">(</span><span style="color: #2040a0">object</span> <span style="color: #2040a0">sender</span>, <span style="color: #2040a0">System</span>.<span style="color: #2040a0">EventArgs</span> <span style="color: #2040a0">e</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>

            <span style="color: #008000">// Populate the shopping cart the first time the page is accessed.</span>
            <span style="color: #0000FF"><strong>if</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">Page</span>.<span style="color: #2040a0">IsPostBack</span> <span style="color: #4444FF">=</span><span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>false</strong></span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>
                <span style="color: #2040a0">PopulateShoppingList</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
            <span style="color: #4444FF"><strong>}</strong></span>
        <span style="color: #4444FF"><strong>}</strong></span>

        <span style="color: #008000">//*******************************************************</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// The UpdateButton_Click event is raised when a user clicks</span>
        <span style="color: #008000">// the &quot;update&quot; button on the client.  The event handler</span>
        <span style="color: #008000">// updates all items in the cart back to the database,</span>
        <span style="color: #008000">// and then repopulates the datagrid with the current</span>
        <span style="color: #008000">// cart contents.</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">//*******************************************************</span>

        <span style="color: #0000FF"><strong>protected</strong></span> <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">UpdateButton_Click</span><span style="color: #4444FF">(</span><span style="color: #2040a0">object</span> <span style="color: #2040a0">sender</span>, <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">ImageClickEventArgs</span> <span style="color: #2040a0">e</span><span style="color: #4444FF">)</span>
        <span style="color: #4444FF"><strong>{</strong></span>
            <span style="color: #008000">// Update the Shopping Cart and then Repopulate the List</span>
            <span style="color: #2040a0">UpdateShoppingCartDatabase</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
            <span style="color: #2040a0">PopulateShoppingList</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
        <span style="color: #4444FF"><strong>}</strong></span>

        <span style="color: #008000">//*******************************************************</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// The CheckoutButton_Click event is raised when a user clicks</span>
        <span style="color: #008000">// the &quot;checkout&quot; button on the client.  The event handler</span>
        <span style="color: #008000">// updates all items in the cart back to the database,</span>
        <span style="color: #008000">// and then redirects the user to the checkout.aspx page</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">//*******************************************************</span>

        <span style="color: #0000FF"><strong>protected</strong></span> <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">CheckoutButton_Click</span><span style="color: #4444FF">(</span><span style="color: #2040a0">object</span> <span style="color: #2040a0">sender</span>, <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">ImageClickEventArgs</span> <span style="color: #2040a0">e</span><span style="color: #4444FF">)</span>
        <span style="color: #4444FF"><strong>{</strong></span>

            <span style="color: #008000">// Update Shopping Cart</span>
            <span style="color: #2040a0">UpdateShoppingCartDatabase</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// If cart is not empty, proceed on to checkout page</span>
            <span style="color: #2040a0">ShoppingCartDB</span> <span style="color: #2040a0">cart</span> <span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>new</strong></span> <span style="color: #2040a0">ShoppingCartDB</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// Calculate shopping cart ID</span>
            <span style="color: #2040a0">String</span> <span style="color: #2040a0">cartId</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetShoppingCartId</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// If the cart isn't empty, navigate to checkout page</span>
            <span style="color: #0000FF"><strong>if</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetItemCount</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span><span style="color: #4444FF">)</span> <span style="color: #4444FF">!</span><span style="color: #4444FF">=</span><span style="color: #FF0000">0</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>
                <span style="color: #2040a0">Response</span>.<span style="color: #2040a0">Redirect</span><span style="color: #4444FF">(</span><span style="color: #444444">&quot;Checkout.aspx&quot;</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
            <span style="color: #4444FF"><strong>}</strong></span>
            <span style="color: #0000FF"><strong>else</strong></span> <span style="color: #4444FF"><strong>{</strong></span>
                <span style="color: #2040a0">MyError</span>.<span style="color: #2040a0">Text</span> <span style="color: #4444FF">=</span> <span style="color: #444444">&quot;You can't proceed to the Check Out page with an empty cart.&quot;</span><span style="color: #4444FF">;</span>
            <span style="color: #4444FF"><strong>}</strong></span>
        <span style="color: #4444FF"><strong>}</strong></span>

        <span style="color: #008000">//*******************************************************</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// The PopulateShoppingList helper method is used to</span>
        <span style="color: #008000">// dynamically populate a GridControl with the contents of</span>
        <span style="color: #008000">// the current user's shopping cart.</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">//*******************************************************</span>

        <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">PopulateShoppingList</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>

            <span style="color: #2040a0">ShoppingCartDB</span> <span style="color: #2040a0">cart</span> <span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>new</strong></span> <span style="color: #2040a0">ShoppingCartDB</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// Obtain current user's shopping cart ID</span>
            <span style="color: #2040a0">String</span> <span style="color: #2040a0">cartId</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetShoppingCartId</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// If no items, hide details and display message</span>
            <span style="color: #0000FF"><strong>if</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetItemCount</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span><span style="color: #4444FF">)</span> <span style="color: #4444FF">=</span><span style="color: #4444FF">=</span> <span style="color: #FF0000">0</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>
                <span style="color: #2040a0">DetailsPanel</span>.<span style="color: #2040a0">Visible</span> <span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>false</strong></span><span style="color: #4444FF">;</span>
                <span style="color: #2040a0">MyError</span>.<span style="color: #2040a0">Text</span> <span style="color: #4444FF">=</span> <span style="color: #444444">&quot;There are currently no items in your shopping cart.&quot;</span><span style="color: #4444FF">;</span>
            <span style="color: #4444FF"><strong>}</strong></span>
            <span style="color: #0000FF"><strong>else</strong></span> <span style="color: #4444FF"><strong>{</strong></span>

                <span style="color: #008000">// Databind Gridcontrol with Shopping Cart Items</span>
                <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">DataSource</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetItems</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
                <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">DataBind</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

                <span style="color: #008000">//Update Total Price Label</span>

				<span style="color: #2040a0">totalLabel</span>.<span style="color: #2040a0">Text</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetTotal</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span><span style="color: #4444FF">)</span>.<span style="color: #2040a0">ToString</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
            <span style="color: #4444FF"><strong>}</strong></span>
        <span style="color: #4444FF"><strong>}</strong></span>

        <span style="color: #008000">//*******************************************************</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">// The UpdateShoppingCartDatabase helper method is used to</span>
        <span style="color: #008000">// update a user's items within the shopping cart database</span>
        <span style="color: #008000">// using client input from the GridControl.</span>
        <span style="color: #008000">//</span>
        <span style="color: #008000">//*******************************************************</span>

        <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">UpdateShoppingCartDatabase</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>

            <span style="color: #2040a0">ShoppingCartDB</span> <span style="color: #2040a0">cart</span> <span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>new</strong></span> <span style="color: #2040a0">ShoppingCartDB</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// Obtain current user's shopping cart ID</span>
            <span style="color: #2040a0">String</span> <span style="color: #2040a0">cartId</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">cart</span>.<span style="color: #2040a0">GetShoppingCartId</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

            <span style="color: #008000">// Iterate through all rows within shopping cart list</span>
            <span style="color: #0000FF"><strong>for</strong></span> <span style="color: #4444FF">(</span><span style="color: #0000FF"><strong>int</strong></span> <span style="color: #2040a0">i</span><span style="color: #4444FF">=</span><span style="color: #FF0000">0</span><span style="color: #4444FF">;</span> <span style="color: #2040a0">i</span> <span style="color: #4444FF">&lt;</span> <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">Items</span>.<span style="color: #2040a0">Count</span><span style="color: #4444FF">;</span> <span style="color: #2040a0">i</span><span style="color: #4444FF">+</span><span style="color: #4444FF">+</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>

                <span style="color: #008000">// Obtain references to row's controls</span>
                <span style="color: #2040a0">TextBox</span> <span style="color: #2040a0">quantityTxt</span> <span style="color: #4444FF">=</span> <span style="color: #4444FF">(</span><span style="color: #2040a0">TextBox</span><span style="color: #4444FF">)</span> <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">Items</span><span style="color: #4444FF">[</span><span style="color: #2040a0">i</span><span style="color: #4444FF">]</span>.<span style="color: #2040a0">FindControl</span><span style="color: #4444FF">(</span><span style="color: #444444">&quot;Quantity&quot;</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
                <span style="color: #2040a0">CheckBox</span> <span style="color: #2040a0">remove</span> <span style="color: #4444FF">=</span> <span style="color: #4444FF">(</span><span style="color: #2040a0">CheckBox</span><span style="color: #4444FF">)</span> <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">Items</span><span style="color: #4444FF">[</span><span style="color: #2040a0">i</span><span style="color: #4444FF">]</span>.<span style="color: #2040a0">FindControl</span><span style="color: #4444FF">(</span><span style="color: #444444">&quot;Remove&quot;</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

                <span style="color: #008000">// Wrap in try/catch block to catch errors in the event that someone types in</span>
                <span style="color: #008000">// an invalid value for quantity</span>
                <span style="color: #0000FF"><strong>int</strong></span> <span style="color: #2040a0">quantity</span><span style="color: #4444FF">;</span>
				<span style="color: #2040a0">try</span> 
				<span style="color: #4444FF"><strong>{</strong></span>
					<span style="color: #2040a0">quantity</span> <span style="color: #4444FF">=</span> <span style="color: #2040a0">Int32</span>.<span style="color: #2040a0">Parse</span><span style="color: #4444FF">(</span><span style="color: #2040a0">quantityTxt</span>.<span style="color: #2040a0">Text</span>, <span style="color: #2040a0">CultureInfo</span>.<span style="color: #2040a0">InvariantCulture</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

					<span style="color: #008000">// If the quantity field is changed or delete is checked</span>
					<span style="color: #0000FF"><strong>if</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">quantity</span> <span style="color: #4444FF">!</span><span style="color: #4444FF">=</span> <span style="color: #4444FF">(</span><span style="color: #0000FF"><strong>int</strong></span><span style="color: #4444FF">)</span><span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">DataKeys</span><span style="color: #4444FF">[</span><span style="color: #2040a0">i</span><span style="color: #4444FF">]</span> <span style="color: #4444FF">|</span><span style="color: #4444FF">|</span> <span style="color: #2040a0">remove</span>.<span style="color: #2040a0">Checked</span> <span style="color: #4444FF">=</span><span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>true</strong></span><span style="color: #4444FF">)</span> 
					<span style="color: #4444FF"><strong>{</strong></span>

						<span style="color: #2040a0">Label</span> <span style="color: #2040a0">productIDLabel</span> <span style="color: #4444FF">=</span> <span style="color: #4444FF">(</span><span style="color: #2040a0">Label</span><span style="color: #4444FF">)</span> <span style="color: #2040a0">MyList</span>.<span style="color: #2040a0">Items</span><span style="color: #4444FF">[</span><span style="color: #2040a0">i</span><span style="color: #4444FF">]</span>.<span style="color: #2040a0">FindControl</span><span style="color: #4444FF">(</span><span style="color: #444444">&quot;ProductID&quot;</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

						<span style="color: #0000FF"><strong>if</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">quantity</span> <span style="color: #4444FF">=</span><span style="color: #4444FF">=</span> <span style="color: #FF0000">0</span> <span style="color: #4444FF">|</span><span style="color: #4444FF">|</span> <span style="color: #2040a0">remove</span>.<span style="color: #2040a0">Checked</span> <span style="color: #4444FF">=</span><span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>true</strong></span><span style="color: #4444FF">)</span> 
						<span style="color: #4444FF"><strong>{</strong></span>
							<span style="color: #2040a0">cart</span>.<span style="color: #2040a0">RemoveItem</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span>, <span style="color: #2040a0">Int32</span>.<span style="color: #2040a0">Parse</span><span style="color: #4444FF">(</span><span style="color: #2040a0">productIDLabel</span>.<span style="color: #2040a0">Text</span>, <span style="color: #2040a0">CultureInfo</span>.<span style="color: #2040a0">InvariantCulture</span><span style="color: #4444FF">)</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
						<span style="color: #4444FF"><strong>}</strong></span>
						<span style="color: #0000FF"><strong>else</strong></span> 
						<span style="color: #4444FF"><strong>{</strong></span>
							<span style="color: #2040a0">cart</span>.<span style="color: #2040a0">UpdateItem</span><span style="color: #4444FF">(</span><span style="color: #2040a0">cartId</span>, <span style="color: #2040a0">Int32</span>.<span style="color: #2040a0">Parse</span><span style="color: #4444FF">(</span><span style="color: #2040a0">productIDLabel</span>.<span style="color: #2040a0">Text</span>, <span style="color: #2040a0">CultureInfo</span>.<span style="color: #2040a0">InvariantCulture</span><span style="color: #4444FF">)</span>,
								<span style="color: #2040a0">quantity</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
						<span style="color: #4444FF"><strong>}</strong></span>
					<span style="color: #4444FF"><strong>}</strong></span>
				<span style="color: #4444FF"><strong>}</strong></span>
				<span style="color: #0000FF"><strong>catch</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">System</span>.<span style="color: #2040a0">FormatException</span><span style="color: #4444FF">)</span> 
				<span style="color: #4444FF"><strong>{</strong></span>
					<span style="color: #2040a0">MyError</span>.<span style="color: #2040a0">Text</span> <span style="color: #4444FF">=</span> <span style="color: #444444">&quot;You must specify a valid number using only numerals&quot;</span><span style="color: #4444FF">;</span>
				<span style="color: #4444FF"><strong>}</strong></span>
				<span style="color: #0000FF"><strong>catch</strong></span> <span style="color: #4444FF">(</span><span style="color: #2040a0">System</span>.<span style="color: #2040a0">OverflowException</span><span style="color: #4444FF">)</span> 
				<span style="color: #4444FF"><strong>{</strong></span>
					<span style="color: #2040a0">MyError</span>.<span style="color: #2040a0">Text</span> <span style="color: #4444FF">=</span> <span style="color: #444444">&quot;You must specify a valid number within range.&quot;</span><span style="color: #4444FF">;</span>
				<span style="color: #4444FF"><strong>}</strong></span>
            <span style="color: #4444FF"><strong>}</strong></span>
        <span style="color: #4444FF"><strong>}</strong></span>

        <span style="color: #0000FF"><strong>private</strong></span> <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">Page_Init</span><span style="color: #4444FF">(</span><span style="color: #2040a0">object</span> <span style="color: #2040a0">sender</span>, <span style="color: #2040a0">EventArgs</span> <span style="color: #2040a0">e</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>
            <span style="color: #008000">//</span>
            <span style="color: #008000">// CODEGEN: This call is required by the ASP.NET Web Form Designer.</span>
            <span style="color: #008000">//</span>
            <span style="color: #2040a0">InitializeComponent</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
        <span style="color: #4444FF"><strong>}</strong></span>

<span style="color: #0000ff"><strong>        #region Web Form Designer generated code</strong></span>
        <span style="color: #008000">/// &lt;summary&gt;</span>
        <span style="color: #008000">/// Required method for Designer support - do not modify</span>
        <span style="color: #008000">/// the contents of this method with the code editor.</span>
        <span style="color: #008000">/// &lt;/summary&gt;</span>
        <span style="color: #0000FF"><strong>private</strong></span> <span style="color: #0000FF"><strong>void</strong></span> <span style="color: #2040a0">InitializeComponent</span><span style="color: #4444FF">(</span><span style="color: #4444FF">)</span> <span style="color: #4444FF"><strong>{</strong></span>
			<span style="color: #0000FF"><strong>this</strong></span>.<span style="color: #2040a0">UpdateButton</span>.<span style="color: #2040a0">Click</span> <span style="color: #4444FF">+</span><span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>new</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">ImageClickEventHandler</span><span style="color: #4444FF">(</span><span style="color: #0000FF"><strong>this</strong></span>.<span style="color: #2040a0">UpdateButton_Click</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>
			<span style="color: #0000FF"><strong>this</strong></span>.<span style="color: #2040a0">CheckoutButton</span>.<span style="color: #2040a0">Click</span> <span style="color: #4444FF">+</span><span style="color: #4444FF">=</span> <span style="color: #0000FF"><strong>new</strong></span> <span style="color: #2040a0">System</span>.<span style="color: #2040a0">Web</span>.<span style="color: #2040a0">UI</span>.<span style="color: #2040a0">ImageClickEventHandler</span><span style="color: #4444FF">(</span><span style="color: #0000FF"><strong>this</strong></span>.<span style="color: #2040a0">CheckoutButton_Click</span><span style="color: #4444FF">)</span><span style="color: #4444FF">;</span>

		<span style="color: #4444FF"><strong>}</strong></span>

<span style="color: #0000ff"><strong>        #endregion</strong></span>

    <span style="color: #4444FF"><strong>}</strong></span>
<span style="color: #4444FF"><strong>}</strong></span>

</pre>
